//
//  Bullet.m
//  BeatPlane
//
//  Created by LZXuan on 15-5-6.
//  Copyright (c) 2015年 轩哥. All rights reserved.
//

#import "Bullet.h"
#import "Plane.h"
#define kBulletSpeed 10
@implementation Bullet
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.image = [UIImage imageNamed:@"bullet"];
    }
    return self;
}

//向上飞  定时器控制器子弹移动
- (void)moveUp {
    CGRect frame = self.frame;
    frame.origin.y -= kBulletSpeed;
    self.frame = frame;
}

- (void)resetFrame {
    //获取单例飞机的地址
    Plane *plane = [Plane defaultPlane];
    CGRect frame = self.frame;
    //飞机在哪里 子弹就从哪里发射
    frame.origin.x = plane.frame.origin.x+(plane.frame.size.width/2-self.frame.size.width/2);
    frame.origin.y = plane.frame.origin.y;
    
    self.frame = frame;
}



@end
